Fix scoped context and conflicting properties#263
Conversation
|
The tests correspond to the initial issue 👍 Thanks for your work ! |
|
The changes might alter behavior in regard to nested contexts. I just pushed a test to this branch which aims to demonstrate that. I am sorry for pushing for a branch that's not mine, I will rather create a new, derived branch the next time @mielvds - I hope this won't create too much of an inconvenience. |
2e9a89e to
7aa493a
Compare
Not at all @anatoly-scherbakov! Could you propagate this test to the JSON-LD test-suite? 🙏 I moved some of the docstring around to where it fits best. Most of it made more sense in the actual code. I added an internal method |
|
Propagated the nested scoped-context regression to the JSON-LD API test suite: w3c/json-ld-api#689 |
…d type-scoped contexts first for a nested node object.
e82e5a1 to
3d42075
Compare
|
@anatoly-scherbakov thanks! I did some final cleanup. It could still use a (minor) code review though. |
This PR fixes #204 and two related tests in the test-suite:
https://w3c.github.io/json-ld-api/tests/toRdf-manifest.html#tc037
https://w3c.github.io/json-ld-api/tests/toRdf-manifest.html#tc038
The issue was that
@nestkeys were delayed for later expansion before their property-scoped context was applied. This fix first gets the scoped@contextfrom the@nestterm and stores this property-scoped context with the key. The delayed nested object expansion then later uses that property-scoped context, so for{ "@context": { "@vocab": "http://example.org/vocab#", "p1": { "@id": "@nest", "@context": { "p2": "http://example.org/ns#P2" } } }, "p1": { "p2": "foo" } }"p2"expands tohttp://example.org/ns#P2instead of falling back to outer@vocab.